import 'dart:io';
import 'package:get/get.dart';
import 'package:images_picker/images_picker.dart';
import 'package:video_player/video_player.dart';
class CourseDetailController extends GetxController{
  //TODO: Implement CourseDetailController
  late VideoPlayerController vpController;
  var imagePath;
  var videoPath;
  ///拍照
  void takePhoto() async {
    List<Media>? image = await ImagesPicker.openCamera(
      pickType: PickType.image,
    );
    print('---------image-------------');
    print(image);
    if (image != null) {
      print('---------image-------again------');
      print(image[0].path);
      print(image[0].thumbPath);
      imagePath = File(image[0].path);
      print('---------image-------again------');
      print(imagePath);
    }
  }
  /// 录像
  void takeVideo() async {
    var video = await ImagesPicker.openCamera(
      pickType: PickType.video,
      // 视频最大时长
      maxTime: 15,
    );
    print('---------video-------------');
    print(video);
    if (video != null) {
      print('---------video-------again------');
      print(video[0].path);
      print(video[0].thumbPath);
      videoPath = File(video[0].path);
      print('---------video-------again------');
      print(videoPath);
    }
  }
  ///上传
  void upLoadImg() async {
    print('我是upLoadImg');
  }

  @override
  void onInit() {
    super.onInit();
  }
  @override
  void onClose() {
    super.onClose();
  }
}
